package estore.web;

import mybatis.dao.Mybatis;
import mybatis.yang.Book;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class addproductServlet extends HttpServlet{
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("charset=utf-8");
        String name=req.getParameter("name");
        String price=req.getParameter("price");
        String num=req.getParameter("num");
        String miaoshu=req.getParameter("description");
        String picture=req.getParameter("picture");
        System.out.println(name);
        Book book=new Book(name,price,num,picture,miaoshu);
        Mybatis mybatis=new Mybatis();
        try {
            boolean s=mybatis.addBook(book);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
